<!-- 公司sop配置 -->
<template>
  <dt-modal-info ref="info" title="案场开启状态" :label-width="100" okText="关闭" :width="1000" @ok="onOk">
    <dt-search ref="search" :label-width="90" :xl="8" :xlBtn="8">
      <Button type="primary" @click="exportBtn">导出</Button>
    </dt-search>

    <dt-grid ref="table" :page="page" :onFetch="onFetch" :height="400" />
  </dt-modal-info>
</template>

<script>
  import protectOption from '@/biz/protectOption/protectOption'
  import columnOpt from '../opt/caseOpenColumn'
  import searchOpt from '../opt/caseSearch'

  export default {
    data() {
      return {
        params: {},
        page: {
          total: 0
        },
        info: {
          orgIds: [],
          buildingName: ''
        }
      }
    },
    methods: {
      exportBtn() {
        protectOption.buildingConfigRecordExport(this.params).then((res) => {
          console.log('导出', res)
        })
      },

      // 列表数据
      onFetch(data) {
        this.params = {
          ...data
        }
        return protectOption
          .buildingConfigRecord(this.params)
          .then((res) => {
            this.page.total = res.total
            return res.records
          })
          .catch((err) => {})
      },

      show() {
        this.info = {
          orgIds: [],
          buildingName: ''
        }
        this.$refs.info.show()
        this.$nextTick(() => {
          this.$refs.table.init(this, new columnOpt(this))
          this.$refs.search.init(this.$refs.table, new searchOpt(this), this.info)
          this.$refs.table.fetch()
        })
      },

      onOk() {
        this.$refs.info.hide()
      }
    }
  }
</script>
<style lang="scss" scoped>
  .taskInfo {
    display: flex;
    flex-wrap: wrap;
    font-size: 16px;
  }

  .taskBj {
    display: flex;
    flex-direction: row;
    margin: 10px 0 10px 20px;

    p {
      span {
        color: #0f42a7;
        cursor: pointer;
      }
    }
  }

  .tips {
    padding: 5px 10px;
    text-align: right;
    line-height: 32px;
    font-size: 14px;
    background: rgba(254, 252, 236, 1);

    .tips_icon {
      font-size: 20px;
      color: #0f42a7;
      vertical-align: sub;
    }
  }
</style>
